package edu.utexas.mapreduce;

import java.net.URL;
import java.util.Map;
import java.util.Set;

interface JobState {

	// TODO - Separate mutable and constant data?
	int getJobID();
	String getOutputDir();
	
	public MapTask reserveIdleMapTask(String owner);
	public ReduceTask reserveIdleReduceTask(String owner);
	public void completeReduceTask(String owner, ReduceTask task);
	public void commitMapResults(String owner, Map<Integer, URL> results);
	public void recoverFromProcessFailure(String failedProcess);
	public void sendNotification();
	public void close();
	
	// activeProcessSet will contain processes that own in-progress tasks
	public boolean mapTasksComplete(Set<String> activeProcessSet);
	public boolean reduceTasksComplete(Set<String> activeProcessSet);
	
	public void markMapTaskInProgress(int id, String owner);
	public void markReduceTaskIdle(int id, String owner);
	public void markReduceTaskInProgress(int id, String owner);
	public void markReduceTaskComplete(int id, String owner);
	public void markNotificationSent();
}
